home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 December / maximum-cd-2009-12.iso / DiscContents / gimp-2.7.0-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / 3d-outline.scm next >
Encoding:
GIMP Script-Fu Script  |  2009-08-19  |  7.6 KB  |  186 lines

  1. ; 3d-outlined-patterned-shadowed-and-bump-mapped-logo :)
  2. ; creates outlined border of a text with patterns
  3. ;
  4. ; GIMP - The GNU Image Manipulation Program
  5. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  6. ;
  7. ; 3d-outline creates outlined border of a text with patterns
  8. ; Copyright (C) 1998 Hrvoje Horvat
  9. ;
  10. ; This program is free software: you can redistribute it and/or modify
  11. ; it under the terms of the GNU General Public License as published by
  12. ; the Free Software Foundation; either version 3 of the License, or
  13. ; (at your option) any later version.
  14. ;
  15. ; This program is distributed in the hope that it will be useful,
  16. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. ; GNU General Public License for more details.
  19. ;
  20. ; You should have received a copy of the GNU General Public License
  21. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  22.  
  23. (define (apply-3d-outline-logo-effect img
  24.                                       logo-layer
  25.                                       text-pattern
  26.                                       outline-blur-radius
  27.                                       shadow-blur-radius
  28.                                       bump-map-blur-radius
  29.                                       noninteractive
  30.                                       s-offset-x
  31.                                       s-offset-y)
  32.   (let* (
  33.         (width (car (gimp-drawable-width logo-layer)))
  34.         (height (car (gimp-drawable-height logo-layer)))
  35.         (bg-layer (car (gimp-layer-new img width height
  36.                                        RGB-IMAGE "Background" 100 NORMAL-MODE)))
  37.         (pattern-layer (car (gimp-layer-new img width height
  38.                                        RGBA-IMAGE "Pattern" 100 NORMAL-MODE)))
  39.         (alpha-layer 0)
  40.         (shadow-layer 0)
  41.         (pattern-mask 0)
  42.         (floating-sel 0)
  43.         )
  44.  
  45.     (gimp-context-push)
  46.  
  47.     (gimp-selection-none img)
  48.     (script-fu-util-image-resize-from-layer img logo-layer)
  49.     (script-fu-util-image-add-layers img pattern-layer bg-layer)
  50.     (gimp-context-set-background '(255 255 255))
  51.     (gimp-edit-fill bg-layer BACKGROUND-FILL)
  52.     (gimp-edit-clear pattern-layer)
  53.     (gimp-layer-set-lock-alpha logo-layer TRUE)
  54.     (gimp-context-set-foreground '(0 0 0))
  55.     (gimp-edit-fill logo-layer FOREGROUND-FILL)
  56.     (gimp-layer-set-lock-alpha logo-layer FALSE)
  57.     (plug-in-gauss-iir RUN-NONINTERACTIVE img logo-layer outline-blur-radius TRUE TRUE)
  58.  
  59.     (gimp-drawable-set-visible pattern-layer FALSE)
  60.     (set! alpha-layer (car (gimp-image-merge-visible-layers img CLIP-TO-IMAGE)))
  61.     (plug-in-edge RUN-NONINTERACTIVE img alpha-layer 2 1 0)
  62.     (gimp-drawable-set-name alpha-layer "Bump map")
  63.     (set! shadow-layer (car (gimp-layer-copy alpha-layer TRUE)))
  64.     (gimp-drawable-set-name shadow-layer "Edges")
  65.     (script-fu-util-image-add-layers img shadow-layer)
  66.     (plug-in-gauss-iir RUN-NONINTERACTIVE img alpha-layer bump-map-blur-radius TRUE TRUE)
  67.  
  68.     (gimp-selection-all img)
  69.     (gimp-context-set-pattern text-pattern)
  70.     (gimp-edit-bucket-fill pattern-layer
  71.                            PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  72.     (plug-in-bump-map noninteractive img pattern-layer alpha-layer
  73.                       110.0 45.0 4 0 0 0 0 TRUE FALSE 0)
  74.  
  75.     (set! pattern-mask (car (gimp-layer-create-mask pattern-layer ADD-ALPHA-MASK)))
  76.     (gimp-layer-add-mask pattern-layer pattern-mask)
  77.  
  78.     (gimp-selection-all img)
  79.     (gimp-edit-copy shadow-layer)
  80.     (set! floating-sel (car (gimp-edit-paste pattern-mask FALSE)))
  81.     (gimp-floating-sel-anchor floating-sel)
  82.  
  83.     (gimp-layer-remove-mask pattern-layer MASK-APPLY)
  84.     (gimp-invert shadow-layer)
  85.     (gimp-drawable-set-name shadow-layer "Drop shadow")
  86.     (plug-in-gauss-iir RUN-NONINTERACTIVE img shadow-layer shadow-blur-radius TRUE TRUE)
  87.  
  88.     (gimp-drawable-offset shadow-layer
  89.                           FALSE OFFSET-BACKGROUND s-offset-x s-offset-y)
  90.  
  91.     (gimp-drawable-set-visible alpha-layer FALSE)
  92.     (gimp-drawable-set-visible pattern-layer TRUE)
  93.     ;;(set! final (car (gimp-image-flatten img)))
  94.  
  95.     (gimp-context-pop)
  96.   )
  97. )
  98.  
  99. (define (script-fu-3d-outline-logo-alpha img
  100.                                          logo-layer
  101.                                          text-pattern
  102.                                          outline-blur-radius
  103.                                          shadow-blur-radius
  104.                                          bump-map-blur-radius
  105.                                          noninteractive
  106.                                          s-offset-x
  107.                                          s-offset-y)
  108.   (begin
  109.     (gimp-image-undo-group-start img)
  110.     (apply-3d-outline-logo-effect img logo-layer text-pattern
  111.                                   outline-blur-radius shadow-blur-radius
  112.                                   bump-map-blur-radius noninteractive
  113.                                   s-offset-x s-offset-y)
  114.     (gimp-image-undo-group-end img)
  115.     (gimp-displays-flush)
  116.   )
  117. )
  118.  
  119. (script-fu-register "script-fu-3d-outline-logo-alpha"
  120.   _"3D _Outline..."
  121.   _"Outline the selected region (or alpha) with a pattern and add a drop shadow"
  122.   "Hrvoje Horvat (hhorvat@open.hr)"
  123.   "Hrvoje Horvat"
  124.   "07 April, 1998"
  125.   "RGBA"
  126.   SF-IMAGE       "Image"               0
  127.   SF-DRAWABLE    "Drawable"            0
  128.   SF-PATTERN    _"Pattern"             "Parque #1"
  129.   SF-ADJUSTMENT _"Outline blur radius" '(5 1 200 1 10 0 1)
  130.   SF-ADJUSTMENT _"Shadow blur radius"  '(10 1 200 1 10 0 1)
  131.   SF-ADJUSTMENT _"Bumpmap (alpha layer) blur radius" '(5 1 200 1 10 0 1)
  132.   SF-TOGGLE     _"Default bumpmap settings" TRUE
  133.   SF-ADJUSTMENT _"Shadow X offset"     '(0 0 200 1 5 0 1)
  134.   SF-ADJUSTMENT _"Shadow Y offset"     '(0 0 200 1 5 0 1)
  135. )
  136.  
  137. (script-fu-menu-register "script-fu-3d-outline-logo-alpha"
  138.                          "<Image>/Filters/Alpha to Logo")
  139.  
  140.  
  141. (define (script-fu-3d-outline-logo text-pattern
  142.                                    text
  143.                                    size
  144.                                    font
  145.                                    outline-blur-radius
  146.                                    shadow-blur-radius
  147.                                    bump-map-blur-radius
  148.                                    noninteractive
  149.                                    s-offset-x
  150.                                    s-offset-y)
  151.   (let* (
  152.         (img (car (gimp-image-new 256 256 RGB)))
  153.         (text-layer (car (gimp-text-fontname img -1 0 0 text 30 TRUE size PIXELS font)))
  154.         )
  155.     (gimp-image-undo-disable img)
  156.     (apply-3d-outline-logo-effect img text-layer text-pattern
  157.                                   outline-blur-radius shadow-blur-radius
  158.                                   bump-map-blur-radius noninteractive
  159.                                   s-offset-x s-offset-y)
  160.     (gimp-image-undo-enable img)
  161.     (gimp-display-new img)
  162.   )
  163. )
  164.  
  165. (script-fu-register "script-fu-3d-outline-logo"
  166.   _"3D _Outline..."
  167.   _"Create a logo with outlined text and a drop shadow"
  168.   "Hrvoje Horvat (hhorvat@open.hr)"
  169.   "Hrvoje Horvat"
  170.   "07 April, 1998"
  171.   ""
  172.   SF-PATTERN    _"Pattern"             "Parque #1"
  173.   SF-STRING     _"Text"                "GIMP"
  174.   SF-ADJUSTMENT _"Font size (pixels)"  '(100 2 1000 1 10 0 1)
  175.   SF-FONT       _"Font"                "RoostHeavy"
  176.   SF-ADJUSTMENT _"Outline blur radius" '(5 1 200 1 10 0 1)
  177.   SF-ADJUSTMENT _"Shadow blur radius"  '(10 1 200 1 10 0 1)
  178.   SF-ADJUSTMENT _"Bumpmap (alpha layer) blur radius" '(5 1 200 1 10 0 1)
  179.   SF-TOGGLE     _"Default bumpmap settings" TRUE
  180.   SF-ADJUSTMENT _"Shadow X offset"     '(0 0 200 1 5 0 1)
  181.   SF-ADJUSTMENT _"Shadow Y offset"     '(0 0 200 1 5 0 1)
  182. )
  183.  
  184. (script-fu-menu-register "script-fu-3d-outline-logo"
  185.                          "<Image>/File/Create/Logos")
  186.